﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Public;

namespace DAL
{
    public class TinhDAL
    {
        public static List<TinhPublic> LoadTinh()
        {
            var tinh = Common.db.ExecuteStoreQuery<TinhPublic>(@"select * from Tinh");
            return tinh.ToList();
        }
        public static string LoadTinhByMaT(int MaT)
        {
            var t = Common.db.ExecuteStoreQuery<string>("select TenTinh from Tinh where MaT=" + MaT);
            return t.FirstOrDefault();
        }
        public static int LoadMaTByMaQH(int MaQH)
        {
            var t = Common.db.ExecuteStoreQuery<int>("select MaT from QuanHuyen where MaQH=" + MaQH);
            return t.FirstOrDefault();
        }
    }
}
